package com.ym.base.domain;

import com.ym.common.utils.StringUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;


@ApiModel(value = "手机端通用查询")
@Data
public class MobileSearchParam {

	@ApiModelProperty("省份")
	private String prov;

	@ApiModelProperty("市")
	private String city;

	@ApiModelProperty("区域")
	private String area;

	@ApiModelProperty("离我最近")
	private boolean recent;

	@ApiModelProperty("经度")
	private String lng;

	@ApiModelProperty("纬度")
	private String lat;

	@ApiModelProperty("关键词")
	@NotNull
	private String keyword;

	@ApiModelProperty("ids")
	private Long[] ids;

	public MobileSearchParam() {
	}

	private MobileSearchParam(String prov, String city, String area, String keyword) {
		this.prov = prov;
		this.city = city;
		this.area = area;
		this.keyword = keyword;
	}

	public static MobileSearchParam build(String prov, String city, String area, String keyword) {
		return new MobileSearchParam(prov, city, area, keyword);
	}

	public boolean isEmpty(){
		return StringUtil.isEmpty(prov) &&  StringUtil.isEmpty(city) &&  StringUtil.isEmpty(area) && StringUtil.isEmpty(keyword);
	}
}
